package com.tuanzi.loan.web.bean.statistics;

import com.tuanzi.loan.business.service.statistics.ActivityParticipateStatService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.vo.request.statistics.UnionLoginStatRequest;
import com.tuanzi.loan.vo.request.statistics.WechatAccountRequest;
import com.tuanzi.loan.vo.response.statistics.WechatAccountResponse;
import com.tuanzi.loan.web.configuration.JSFListingBean;
import com.tuanzi.loan.web.lazy.statistics.UnionLoginStatLazyDataModel;
import com.tuanzi.loan.web.lazy.statistics.WechatAccountLazyDataModel;
import com.tuanzi.server.loan_base.model.db.LoanProductInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped;
import java.util.List;

/**
 * @Auther: hequnayu
 * @Date: 2019/5/14 14:04
 * @Description:
 */
@Data
@Debug
@Component
@ViewScoped
@EqualsAndHashCode(callSuper = true)
public class WechatAccountBean extends JSFListingBean<WechatAccountRequest, WechatAccountResponse> {

    @Autowired
    ActivityParticipateStatService activityParticipateStatService;
    private List<LoanProductInfo> activityList;

    @PostConstruct
    public void init() {
        activityList = activityParticipateStatService.getActivity();
        initLazyDataModel();
    }

    public void onRest(){
        init();
    }

    private void initLazyDataModel() {
        $ = new WechatAccountRequest();
        lazyDataModel = new WechatAccountLazyDataModel($);
    }
}
